
import {
	writeBLECharacteristicValue,
	ut_fn_getType
} from '@/utils/bluteMethod.js'
import {
	useStore
} from 'vuex';
const store = useStore();
//写入数据
const writeFn = ({
	id,
	code,
	deviceOBj,
	type,
	fn
}, fuc) => {
	let writeCode = fuc(id, code, deviceOBj,type);
	writeBLECharacteristicValue({
		...deviceOBj,
		writeCode,
	})
};
//写入床
export const writeSmartBed = (() => {
	const wifi = {
		name: "0x090x00", // wifi账号  
		password: "0x0d0x00", // wifi密码  
		link: "0x0c0x00", // 连接wifi  
	};
	return ({
		id,
		code = "",
		deviceOBj,
		fn
	}) => {
		writeFn({
				id,
				code,
				deviceOBj,
				type,
				fn
			},
			(id,code,type) => {
				console.log(type)
				switch (id) {
					case 1:
						writeCode = '0x000x000x100x00';
						break; // 连接监测带  
					case 2:
						writeCode =
							`${wifi.name}0x${hexString}0x${code?.wifinamelength}${code.hexCharname}`;
						break;
					case 3:
						writeCode =
							`${wifi.password}0x${hexString}0x${code?.wifinamelength}${code.hexCharname}`;
						break;
					case 4:
						writeCode = `${wifi.link}0x${hexString}0x00`;
						break;
					case 5:
				}
				return writeCode;
			}
		);
	};
})();